package dk.itu.spct;

import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Observable;
import java.util.Observer;

import org.mt4j.MTApplication;

public class Tabletop extends MTApplication implements Observer {
	
	public static int coinCost = 0;
	
	public static void main(String[] args) {
		initialize();
	}
	
	public void startImageServer() {
		ImageServer is = new ImageServer(this);
		new Thread(is).start();
	}
	
	public static void startImageClient(File myFile) {
		ImageClient ic = new ImageClient(myFile);
		new Thread(ic).start();
		coinCost++;
	}
	
	public void startNFCServer() {
		NFCServer ns = new NFCServer();
		new Thread(ns).start();
	}
	
	public void update(Observable observable, Object data) {
		BufferedImage castData = (BufferedImage) data;
		((ImageScene) this.getScene("UI")).loadImage(castData);
	}

	@Override
	public void startUp() {
		addScene(new ImageScene(this, "UI"));
		startNFCServer();
		startImageServer();
	}
}
